﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using CommunitySystem.DataQueryService;

namespace EHR.Views
{
    public partial class DesignSourceSelecterView : UserControl
    {
        public event EventHandler NextStep;

        public IList<ViewInfo> Tables
        {
            set { cmbTables.ItemsSource = value; }
        }

        public ViewInfo SelectedViewInfo
        {
            get { return cmbTables.SelectedItem as ViewInfo; }
        }

        public DesignSourceSelecterView()
        {
            InitializeComponent();
        }

        private void cmbTables_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cmbTables != null)
            {
                btnNext.IsEnabled = cmbTables.SelectedIndex != -1;
            }
        }

        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            if (NextStep != null)
            {
                NextStep(this, new EventArgs());
            }
        }

        private void overComboBoxBorder_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (!cmbTables.IsDropDownOpen)
            {
                cmbTables.IsDropDownOpen = true;
            }
        }
    }
}
